﻿-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================

CREATE PROCEDURE [dbo].[InsertExposureEnvelope]
	-- Add the parameters for the stored procedure here
	@ExposureKey int,
	@BigLat nvarchar(100),
	@SmallLat nvarchar(100),
	@BigLon nvarchar(100),
	@SmallLon nvarchar(100)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	update [ExposureCache]  
	Set [GeoRSSWhere] = geography::STPolyFromText('POLYGON(('+@BigLon +' '+@BigLat +','+@SmallLon +' '+@BigLat +','+@SmallLon +' '+@SmallLat +','+@BigLon +' '+@SmallLat +','+@BigLon+' '+@BigLat+'))',4326)
	--Set[GeoRSSWhere] = geography::STPolyFromText('POLYGON((-122.358 47.653, -122.348 47.649, -122.348 47.658, -122.358 47.658, -122.358 47.653))', 4326);
	WHERE [Id] = @ExposureKey
END
;
